console.log(window.localStorage.getItem("flag"));
// window.localStorage.setItem("flag", false);

if (window.localStorage.getItem("flag") == "true") {
    document.getElementsByClassName("userImg")[0].style.cssText = "opacity:1;";
    document.getElementsByClassName("userText")[0].innerText = "欢迎您，" + window.localStorage.getItem("uname");
    document.getElementsByClassName("off")[0].style.cssText = "opacity:1;";
} else {
    document.getElementsByClassName("userImg")[0].style.cssText = "opacity:0;";
    document.getElementsByClassName("userText")[0].innerText = '请先登录';
}

function off() {
    if (window.localStorage.getItem("flag") == "true") {
        alert('注销成功了惹 =。=');
        window.localStorage.setItem("flag", false);
        document.getElementsByClassName("off")[0].style.cssText = "opacity:0;";
        location.reload();
    } else {
        window.open('login.html');
        window.close('index.html');
    }
}

function back0() {
    window.open('index.html');
    window.close('login.html');
}

function back1() {
    window.open('index.html');
    window.close('reg.html');
}

// 登录
function login() {
    var n = document.getElementsByClassName("i1")[0];
    n.style.cssText = "border: solid 1px #ddd;";
    var n = document.getElementsByClassName("i2")[0];
    n.style.cssText = "border: solid 1px #ddd;";
    var n = document.getElementsByClassName("null1")[0];
    n.style.cssText = "opacity: 0;";
    var n = document.getElementsByClassName("null2")[0];
    n.style.cssText = "opacity: 0;";
    var n = document.getElementsByClassName("null3")[0];
    n.style.cssText = "opacity: 0;";
    var n = document.getElementsByClassName("er1")[0];
    n.style.cssText = "opacity: 0;";
    var n = document.getElementsByClassName("er2")[0];
    n.style.cssText = "opacity: 0;";

    var alo = document.getElementsByClassName("lo1")[0].value;
    var plo = document.getElementsByClassName("lo2")[0].value;

    if (alo == '' && plo == '') {
        var n = document.getElementsByClassName("i1")[0];
        n.style.cssText = "border: solid 1px #f66495;";
        var n = document.getElementsByClassName("i2")[0];
        n.style.cssText = "border: solid 1px #f66495;";
        var n = document.getElementsByClassName("null1")[0];
        n.style.cssText = "opacity: 1;";
        var n = document.getElementsByClassName("null2")[0];
        n.style.cssText = "opacity: 1;";
        var n = document.getElementsByClassName("er1")[0];
        n.style.cssText = "opacity: 1;";
        var n = document.getElementsByClassName("er2")[0];
        n.style.cssText = "opacity: 1;";
        return;
    }
    if (alo != '' && plo == '') {
        var n = document.getElementsByClassName("i2")[0];
        n.style.cssText = "border: solid 1px #f66495;";
        var n = document.getElementsByClassName("null2")[0];
        n.style.cssText = "opacity: 1;";
        var n = document.getElementsByClassName("er2")[0];
        n.style.cssText = "opacity: 1;";
        return;
    }
    if (alo == '' && plo != '') {
        var n = document.getElementsByClassName("i1")[0];
        n.style.cssText = "border: solid 1px #f66495;";
        var n = document.getElementsByClassName("null1")[0];
        n.style.cssText = "opacity: 1;";
        var n = document.getElementsByClassName("er1")[0];
        n.style.cssText = "opacity: 1;";
        return;
    }
    if (alo != '' && plo != '') {
        if (window.localStorage.getItem(alo) == null || window.localStorage.getItem(alo) != plo) {
            var n = document.getElementsByClassName("i1")[0];
            n.style.cssText = "border: solid 1px #f66495;";
            var n = document.getElementsByClassName("i2")[0];
            n.style.cssText = "border: solid 1px #f66495;";
            var n = document.getElementsByClassName("null3")[0];
            n.style.cssText = "opacity: 1;";
            var n = document.getElementsByClassName("er1")[0];
            n.style.cssText = "opacity: 1;";
            var n = document.getElementsByClassName("er2")[0];
            n.style.cssText = "opacity: 1;";
            return;
        } else {
            window.localStorage.setItem("flag", true);
            window.localStorage.setItem("uname", alo);
            successDivShow();
            timer = setTimeout(function () {
                window.open('index.html');
                window.close('login.html');
            }, 3000);
        }
    }
}


// 注册
function reg() {
    // window.localStorage.clear();
    var n = document.getElementsByClassName("n0")[0];
    n.style.cssText = "opacity: 0;"
    var n = document.getElementsByClassName("n1")[0];
    n.style.cssText = "opacity: 0;"
    var n = document.getElementsByClassName("n2-2")[0];
    n.style.cssText = "opacity: 0;"
    var n = document.getElementsByClassName("n2-1")[0];
    n.style.cssText = "opacity: 0;"

    var account = document.getElementsByClassName("reg1")[0].value;
    var password = document.getElementsByClassName("reg2")[0].value;
    if (account == '' && password == '') {
        var n = document.getElementsByClassName("n1")[0];
        n.style.cssText = "opacity: 1;"
        var n = document.getElementsByClassName("n2-1")[0];
        n.style.cssText = "opacity: 1;"
        return;
    }
    if (account == '' && password != '') {
        if (password.length < 6) {
            var n = document.getElementsByClassName("n1")[0];
            n.style.cssText = "opacity: 1;"
            var n = document.getElementsByClassName("n2-1")[0];
            n.style.cssText = "opacity: 1;"
        }
        if (password.length > 16) {
            var n = document.getElementsByClassName("n1")[0];
            n.style.cssText = "opacity: 1;"
            var n = document.getElementsByClassName("n2-2")[0];
            n.style.cssText = "opacity: 1;"
        }
        return;
    }
    if (account != '' && password == '') {
        if (window.localStorage.getItem(account) != null) {
            var n = document.getElementsByClassName("n0")[0];
            n.style.cssText = "opacity: 1;"
        }
        var n = document.getElementsByClassName("n2-1")[0];
        n.style.cssText = "opacity: 1;"
        return;
    }

    if (account != '' && password != '') {
        console.log(account);
        if (window.localStorage.getItem(account) != null) {
            var n = document.getElementsByClassName("n0")[0];
            n.style.cssText = "opacity: 1;"
            return;
        }
        if (password.length < 6) {
            var n = document.getElementsByClassName("n2-1")[0];
            n.style.cssText = "opacity: 1;"
            return;
        }
        if (password.length > 16) {
            var n = document.getElementsByClassName("n2-2")[0];
            n.style.cssText = "opacity: 1;"
            return;
        }
        window.localStorage.setItem(account, password);
        successDivShow();
        timer = setTimeout(function () {
            window.open('login.html');
            window.close('reg.html');
        }, 3000);
    }

}

// 获取数据
// alert(window.localStorage.getItem(account));
// 清除某个数据
// window.localStorage.removeItem("gender")
// 清空所有数据
// window.localStorage.clear()

// 打开赛事预测
function showAndChange1() {
    var hd1 = document.getElementsByClassName("hd1")[0];
    hd1.style.cssText = "color: #00a1d6;border-bottom:#00a1d6 4px solid;";
    var hd2 = document.getElementsByClassName("hd2")[0];
    hd2.style.cssText = "color: #a6a8ad;border-bottom:none;";
    var bd1 = document.getElementsByClassName("bd1")[0];
    bd1.style.cssText = "opacity: 1;z-index:0;"
    var bd2 = document.getElementsByClassName("bd2")[0];
    bd2.style.cssText = "opacity: 0;z-index:-1;"

    bibiLine();
}

// 打开实时票况
function showAndChange2() {
    var hd1 = document.getElementsByClassName("hd1")[0];
    hd1.style.cssText = "color: #a6a8ad;border-bottom:none;";
    var hd2 = document.getElementsByClassName("hd2")[0];
    hd2.style.cssText = "color: #00a1d6;border-bottom:#00a1d6 4px solid;";
    var bd1 = document.getElementsByClassName("bd1")[0];
    bd1.style.cssText = "opacity: 0;z-index:-1;"
    var bd2 = document.getElementsByClassName("bd2")[0];
    bd2.style.cssText = "opacity: 1;z-index:0;"

    biubiuLine();
}

// 投票渐变条增长
function biubiuLine() {
    var ig = document.getElementsByClassName("ig")[0];
    ig.style.cssText = "width:830px;";
    var ra = document.getElementsByClassName("ra")[0];
    ra.style.cssText = "width:690px;";
    var tt = document.getElementsByClassName("tt")[0];
    tt.style.cssText = "width:570px;";
    var jdg = document.getElementsByClassName("jdg")[0];
    jdg.style.cssText = "width:470px;";
    var lgd = document.getElementsByClassName("lgd")[0];
    lgd.style.cssText = "width:410px;";
    var rw = document.getElementsByClassName("rw")[0];
    rw.style.cssText = "width:380px;";

    timer = setTimeout(function () {
        var upvn = document.getElementsByClassName("upvn");
        timer = setTimeout(function () {
            upvn[0].style.cssText = "top:15px;";
        }, 0);
        timer = setTimeout(function () {
            upvn[1].style.cssText = "top:15px;";
        }, 50);
        timer = setTimeout(function () {
            upvn[2].style.cssText = "top:15px;";
        }, 200);
        timer = setTimeout(function () {
            upvn[3].style.cssText = "top:15px;";
        }, 350);
        timer = setTimeout(function () {
            upvn[4].style.cssText = "top:15px;";
        }, 400);
        timer = setTimeout(function () {
            upvn[5].style.cssText = "top:15px;";
        }, 450);
    }, 600);
}

// 投票渐变条缩短
function bibiLine() {
    var ig = document.getElementsByClassName("ig")[0];
    ig.style.cssText = "width:530px;";
    var ra = document.getElementsByClassName("ra")[0];
    ra.style.cssText = "width:390px;";
    var tt = document.getElementsByClassName("tt")[0];
    tt.style.cssText = "width:270px;";
    var jdg = document.getElementsByClassName("jdg")[0];
    jdg.style.cssText = "width:170px;";
    var lgd = document.getElementsByClassName("lgd")[0];
    lgd.style.cssText = "width:110px;";
    var rw = document.getElementsByClassName("rw")[0];
    rw.style.cssText = "width:80px;";

    var upvn = document.getElementsByClassName("upvn");
    for (var i = 0; i < 7; i++) {
        upvn[i].style.cssText = "top:35px;";
    }
}

// 日期往左调整
var leftOverFlow = 0;
function leftTime() {
    if (leftOverFlow > 0) {
        var timeMap = document.getElementsByClassName("day");
        for (var i = 0; i < timeMap.length; i++) {
            var weekDay = timeMap[i].children[0].innerText[2];
            console.log(weekDay);
            switch (weekDay) {
                case "日": timeMap[i].children[0].innerText = "星期六"; break;
                case '一': timeMap[i].children[0].innerText = "星期日"; break;
                case '二': timeMap[i].children[0].innerText = "星期一"; break;
                case '三': timeMap[i].children[0].innerText = "星期二"; break;
                case '四': timeMap[i].children[0].innerText = "星期三"; break;
                case '五': timeMap[i].children[0].innerText = "星期四"; break;
                case '六': timeMap[i].children[0].innerText = "星期五"; break;
            }
            var dateText = timeMap[i].children[1].innerText;
            var date = 0;
            var temp = 10;
            for (var j = 3; j < 5; j++) {
                date = date * temp + parseInt(dateText[j]);
            }
            console.log(date);
            if (date <= 10) {
                timeMap[i].children[1].innerText = "06月0" + (date - 1).toString() + "日";
            } else {
                timeMap[i].children[1].innerText = "06月" + (date - 1).toString() + "日";
            }
        }
        rightOverFlow++;
        leftOverFlow--;
    }
}

// 日期往右调整
var rightOverFlow = 10;
function rightTime() {
    if (rightOverFlow <= 10 && rightOverFlow > 0) {
        var timeMap = document.getElementsByClassName("day");
        for (var i = 0; i < timeMap.length; i++) {
            var weekDay = timeMap[i].children[0].innerText[2];
            console.log(weekDay);
            switch (weekDay) {
                case "日": timeMap[i].children[0].innerText = "星期一"; break;
                case '一': timeMap[i].children[0].innerText = "星期二"; break;
                case '二': timeMap[i].children[0].innerText = "星期三"; break;
                case '三': timeMap[i].children[0].innerText = "星期四"; break;
                case '四': timeMap[i].children[0].innerText = "星期五"; break;
                case '五': timeMap[i].children[0].innerText = "星期六"; break;
                case '六': timeMap[i].children[0].innerText = "星期日"; break;
            }
            var dateText = timeMap[i].children[1].innerText;
            var date = 0;
            var temp = 10;
            for (var j = 3; j < 5; j++) {
                date = date * temp + parseInt(dateText[j]);
            }
            console.log(date);
            if (date < 9) {
                timeMap[i].children[1].innerText = "06月0" + (date + 1).toString() + "日";
            } else {
                timeMap[i].children[1].innerText = "06月" + (date + 1).toString() + "日";
            }
        }
        rightOverFlow--;
        leftOverFlow++;
    }
}

function day0() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 0) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:0;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:1;";
}

function day1() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 1) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:1;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:0;";
}

function day2() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 2) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:1;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:0;";
}

function day3() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 3) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:1;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:0;";
}

function day4() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 4) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:1;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:0;";
}

function day5() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 5) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:1;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:0;";
}

function day6() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        if (i == 6) {
            day[i].style.cssText = "color: #ffffff; background-color: #00a1d6;";
        } else {
            day[i].style.cssText = "color: #99a2aa; background-color: none;"
        }
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #99a2aa; background-color: #f4f5f7;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:1;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:0;";
}

function allDay() {
    var day = document.getElementsByClassName("day");
    for (var i = 0; i < day.length; i++) {
        day[i].style.cssText = "color: #99a2aa; background-color: none;"
    }
    var allDay = document.getElementsByClassName("timeAll")[0];
    allDay.style.cssText = "color: #ffffff; background-color: #00a1d6;";
    var nullSearch = document.getElementsByClassName("nullSearch")[0];
    nullSearch.style.cssText = "opacity:0;";
    var vote = document.getElementsByClassName("vote")[0];
    vote.style.cssText = "opacity:1;";
}

// 投票成功提示
function successDivShow() {
    var show = document.getElementsByClassName("successDiv")[0];
    show.style.cssText = "top:15px;";
    timer = setTimeout(function () {
        show.style.cssText = "top:-50px;";
    }, 2000);
}

// 清理历史记录为空的提示
function clearHis() {
    var hisText = document.getElementsByClassName("hisDef")[0];
    hisText.innerText = "";
    hisText.style.cssText = "top:600px;";
}


var hisHigh = 0;
var vn = 0;

// 第一组对手
var Teams1 = false;

function voteThem11() {
    if (window.localStorage.getItem("flag") == "false") {
        alert('先去登录叭 ^ 3^');
        return;
    }
    if (!Teams1) {
        successDivShow();
        clearHis();
        var opt = document.getElementsByClassName("opt1")[0];
        opt.style.cssText = "background-color:#fff8ea;color:#fff2d7;border: #ffebc4 solid 1px;cursor: default;";
        var opt = document.getElementsByClassName("opt1")[1];
        opt.style.cssText = "cursor: default;";
        var oline = document.getElementsByClassName("oline1")[0];
        oline.style.cssText = " border: #ffbb2f solid 1px;"
        judge1 = true;

        var vtn = document.getElementsByClassName("vtn1")[0];
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn1")[1];
        vtn.innerText = "已参与，请等待开赛...";
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn2")[1];
        vtn.innerText = "已参与，请等待开赛...";

        Teams1 = true;

        var htype = document.getElementsByClassName("c1")[0];
        htype.children[7].innerText = "您为 TT 投出一票~ (尚未结算)";
        var high = hisHigh * 130 + 10;
        htype.style.cssText = "top:" + high + "px;opacity: 1;";
        hisHigh++;
        document.getElementsByClassName("u21")[0].innerText = ++vn;

        document.getElementsByClassName("utn3")[0].innerText += " (您支持的队伍)";
        console.log(a);
    }
}
function voteThem12() {
    if (window.localStorage.getItem("flag") == "false") {
        alert('先去登录叭 ^ 3^');
        return;
    }
    if (!Teams1) {
        successDivShow();
        clearHis();
        var opt = document.getElementsByClassName("opt1")[1];
        opt.style.cssText = "background-color:#fff8ea;color:#fff2d7;border: #ffebc4 solid 1px;cursor: default;";
        var opt = document.getElementsByClassName("opt1")[0];
        opt.style.cssText = "cursor: default;";
        var oline = document.getElementsByClassName("oline1")[1];
        oline.style.cssText = " border: #ffbb2f solid 1px;"
        judge1 = true;

        var vtn = document.getElementsByClassName("vtn2")[0];
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn2")[1];
        vtn.innerText = "已参与，请等待开赛...";
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn1")[1];
        vtn.innerText = "已参与，请等待开赛...";

        Teams1 = true;

        var htype = document.getElementsByClassName("c1")[0];
        htype.children[7].innerText = "您为 北京JDG 投出一票~ (尚未结算)";
        var high = hisHigh * 130 + 10;
        htype.style.cssText = "top:" + high + "px;opacity: 1;";
        hisHigh++;
        document.getElementsByClassName("u21")[0].innerText = ++vn;
        document.getElementsByClassName("utn4")[0].innerText += " (您支持的队伍)";
    }
}

// 第二组对手
var Teams2 = false;
function voteThem21() {
    if (window.localStorage.getItem("flag") == "false") {
        alert('先去登录叭 ^ 3^');
        return;
    }
    if (!Teams2) {
        successDivShow();
        clearHis();
        var opt = document.getElementsByClassName("opt2")[0];
        opt.style.cssText = "background-color:#fff8ea;color:#fff2d7;border: #ffebc4 solid 1px;cursor: default;";
        var opt = document.getElementsByClassName("opt2")[1];
        opt.style.cssText = "cursor: default;";
        var oline = document.getElementsByClassName("oline2")[0];
        oline.style.cssText = " border: #ffbb2f solid 1px;"
        judge2 = true;

        var vtn = document.getElementsByClassName("vtn3")[0];
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn3")[1];
        vtn.innerText = "已参与，请等待开赛...";
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn4")[1];
        vtn.innerText = "已参与，请等待开赛...";

        Teams2 = true;

        var htype = document.getElementsByClassName("c2")[0];
        htype.children[7].innerText = "您为 IG 投出一票~ (尚未结算)";
        var high = hisHigh * 130 + 10;
        htype.style.cssText = "top:" + high + "px;opacity: 1;";
        hisHigh++;
        document.getElementsByClassName("u21")[0].innerText = ++vn;

        var a = document.getElementsByClassName("utn1")[0].innerText += " (您支持的队伍)";
        console.log(a);
    }

}
function voteThem22() {
    if (window.localStorage.getItem("flag") == "false") {
        alert('先去登录叭 ^ 3^');
        return;
    }
    if (!Teams2) {
        successDivShow();
        clearHis();
        var opt = document.getElementsByClassName("opt2")[1];
        opt.style.cssText = "background-color:#fff8ea;color:#fff2d7;border: #ffebc4 solid 1px;cursor: default;";
        var opt = document.getElementsByClassName("opt2")[0];
        opt.style.cssText = "cursor: default;";
        var oline = document.getElementsByClassName("oline2")[1];
        oline.style.cssText = " border: #ffbb2f solid 1px;"
        judge2 = true;

        var vtn = document.getElementsByClassName("vtn4")[0];
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn4")[1];
        vtn.innerText = "已参与，请等待开赛...";
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn3")[1];
        vtn.innerText = "已参与，请等待开赛...";

        Teams2 = true;
        var htype = document.getElementsByClassName("c2")[0];
        htype.children[7].innerText = "您为 RW 投出一票~ (尚未结算)";
        var high = hisHigh * 130 + 10;
        htype.style.cssText = "top:" + high + "px;opacity: 1;";
        hisHigh++;
        document.getElementsByClassName("u21")[0].innerText = ++vn;
        document.getElementsByClassName("utn6")[0].innerText += " (您支持的队伍)";
    }
}

// 第三组对手
var Teams3 = false;
function voteThem31() {
    if (window.localStorage.getItem("flag") == "false") {
        alert('先去登录叭 ^ 3^');
        return;
    }
    if (!Teams3) {
        successDivShow();
        clearHis();
        var opt = document.getElementsByClassName("opt3")[0];
        opt.style.cssText = "background-color:#fff8ea;color:#fff2d7;border: #ffebc4 solid 1px;cursor: default;";
        var opt = document.getElementsByClassName("opt3")[1];
        opt.style.cssText = "cursor: default;";
        var oline = document.getElementsByClassName("oline3")[0];
        oline.style.cssText = " border: #ffbb2f solid 1px;"
        judge3 = true;

        var vtn = document.getElementsByClassName("vtn5")[0];
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn5")[1];
        vtn.innerText = "已参与，请等待开赛...";
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn6")[1];
        vtn.innerText = "已参与，请等待开赛...";

        Teams3 = true;

        var htype = document.getElementsByClassName("c3")[0];
        htype.children[7].innerText = "您为 RA 投出一票~ (尚未结算)";
        var high = hisHigh * 130 + 10;
        htype.style.cssText = "top:" + high + "px;opacity: 1;";
        hisHigh++;
        document.getElementsByClassName("u21")[0].innerText = ++vn;
        document.getElementsByClassName("utn2")[0].innerText += " (您支持的队伍)";
    }
}
function voteThem32() {
    if (window.localStorage.getItem("flag") == "false") {
        alert('先去登录叭 ^ 3^');
        return;
    }
    if (!Teams3) {
        successDivShow();
        clearHis();
        var opt = document.getElementsByClassName("opt3")[1];
        opt.style.cssText = "background-color:#fff8ea;color:#fff2d7;border: #ffebc4 solid 1px;cursor: default;";
        var opt = document.getElementsByClassName("opt3")[0];
        opt.style.cssText = "cursor: default;";
        var oline = document.getElementsByClassName("oline3")[1];
        oline.style.cssText = " border: #ffbb2f solid 1px;"
        judge3 = true;

        var vtn = document.getElementsByClassName("vtn6")[0];
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn6")[1];
        vtn.innerText = "已参与，请等待开赛...";
        vtn.style.cssText = "color:#ffbb2f;";
        var vtn = document.getElementsByClassName("vtn5")[1];
        vtn.innerText = "已参与，请等待开赛...";

        Teams3 = true;

        var htype = document.getElementsByClassName("c3")[0];
        htype.children[7].innerText = "您为 杭州LGD 投出一票~ (尚未结算)";
        var high = hisHigh * 130 + 10;
        htype.style.cssText = "top:" + high + "px;opacity: 1;";
        hisHigh++;
        document.getElementsByClassName("u21")[0].innerText = ++vn;
        document.getElementsByClassName("utn5")[0].innerText += " (您支持的队伍)";

    }
}

// 一个赛事投票后不能再进行这个赛事的投票
// 第一组
var judge1 = false;
var teams1_op1 = document.getElementsByClassName("opt1")[0];
teams1_op1.addEventListener("mouseover", function () {
    if (!judge1) {
        teams1_op1.style.cssText = "background-color: #ffffff;box-shadow: 1px 1px 5px #55555555;";
    }
});
teams1_op1.addEventListener("mouseout", function () {
    if (!judge1) {
        teams1_op1.style.cssText = "background-color: #f9f9f9;box-shadow: none;";
    }
});
var teams1_op2 = document.getElementsByClassName("opt1")[1];
teams1_op2.addEventListener("mouseover", function () {
    if (!judge1) {
        teams1_op2.style.cssText = "background-color: #ffffff;box-shadow: 1px 1px 5px #55555555;";
    }
});
teams1_op2.addEventListener("mouseout", function () {
    if (!judge1) {
        teams1_op2.style.cssText = "background-color: #f9f9f9;box-shadow: none;";
    }
});

// 第二组
var judge2 = false;
var teams2_op1 = document.getElementsByClassName("opt2")[0];
teams2_op1.addEventListener("mouseover", function () {
    if (!judge2) {
        teams2_op1.style.cssText = "background-color: #ffffff;box-shadow: 1px 1px 5px #55555555;"
    }
});
teams2_op1.addEventListener("mouseout", function () {
    if (!judge2) {
        teams2_op1.style.cssText = "background-color: #f9f9f9;box-shadow: none;";
    }
});

var teams2_op2 = document.getElementsByClassName("opt2")[1];
teams2_op2.addEventListener("mouseover", function () {
    if (!judge2) {
        teams2_op2.style.cssText = "background-color: #ffffff;box-shadow: 1px 1px 5px #55555555;"
    }
});
teams2_op2.addEventListener("mouseout", function () {
    if (!judge2) {
        teams2_op2.style.cssText = "background-color: #f9f9f9;box-shadow: none;";
    }
});


// 第三组
var judge3 = false;
var teams3_op1 = document.getElementsByClassName("opt3")[0];
teams3_op1.addEventListener("mouseover", function () {
    if (!judge3) {
        teams3_op1.style.cssText = "background-color: #ffffff;box-shadow: 1px 1px 5px #55555555;"
    }
});
teams3_op1.addEventListener("mouseout", function () {
    if (!judge3) {
        teams3_op1.style.cssText = "background-color: #f9f9f9;box-shadow: none;";
    }
});

var teams3_op2 = document.getElementsByClassName("opt3")[1];
teams3_op2.addEventListener("mouseover", function () {
    if (!judge3) {
        teams3_op2.style.cssText = "background-color: #ffffff;box-shadow: 1px 1px 5px #55555555;"
    }
});
teams3_op2.addEventListener("mouseout", function () {
    if (!judge3) {
        teams3_op2.style.cssText = "background-color: #f9f9f9;box-shadow: none;";
    }
});